/*
 * @[H]:  Copyright (c) 2021 Phytium Information Technology, Inc. 
 * 
 *  SPDX-License-Identifier: Apache-2.0. 
 * 
 * @Date: 2021-08-31 09:56:32
 * @LastEditTime: 2021-09-07 09:10:38
 * @Description:  Description of file
 * @Modify History: 
 * * * Ver   Who        Date         Changes
 * * ----- ------     --------    --------------------------------------
 */

#include "sys_init.h"
#include "ft_types.h"
#include "psci.h"
#include "shell.h"
#include "ft_debug.h"
#include "fsleep.h"

#define LIBMETAL_MAIN_DEBUG_TAG "LIBMETAL_MAIN"
#define LIBMETAL_MAIN_DEBUG_I(format, ...) FT_DEBUG_PRINT_I(LIBMETAL_MAIN_DEBUG_TAG, format, ##__VA_ARGS__)
#define LIBMETAL_MAIN_DEBUG_W(format, ...) FT_DEBUG_PRINT_W(LIBMETAL_MAIN_DEBUG_TAG, format, ##__VA_ARGS__)
#define LIBMETAL_MAIN_DEBUG_E(format, ...) FT_DEBUG_PRINT_E(LIBMETAL_MAIN_DEBUG_TAG, format, ##__VA_ARGS__)

extern int shmem_demo() ;
extern int atomic_shmem_demo() ;
extern void TestLetterShell() ;


static int LibmetalApu(int argc, char *argv[])
{
    /* Wake up from a nuclear */
    PsciCpuOn(CONFIG_TARGET_CPU_ID,(uintptr)CONFIG_TARGET_CPU_FUNCATION_ADDR) ;
    fsleep_seconds(1);
    shmem_demo() ;
    atomic_shmem_demo() ;
} 

SHELL_EXPORT_CMD(SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), LibmetalApu, LibmetalApu, LibmetalApu);


int main(void)
{
    s32 ret ;
    ret = SysInit() ;
    if(ret)
    {
        LIBMETAL_MAIN_DEBUG_E("Failed to initialize system.\n");
		return ret;
    }
    TestLetterShell() ;
}



